package com.powergisol.gis.controller;

import com.powergisol.gis.service.TabPiLeService;
import com.powergisol.gis.util.Result;
import com.powergisol.gis.vo.TabPileVO;
import com.powergisol.gis.vo.TabUserVo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.multipart.MultipartFile;

import java.nio.file.attribute.BasicFileAttributeView;
import java.security.Principal;

/**
 * @author : laishihao
 * @date : 2020/10/24
 * description :
 */
@RestController
@RequestMapping("/pile")
public class TabPiLeController extends BaseController {

    @Autowired
    private TabPiLeService piLeService;

    /**
     * cdm新标准
     *
     * @param excelFile
     * @param vo
     * @param p
     * @return
     */
    @PostMapping("/excelImport")
    public Result excelImport(MultipartFile excelFile, TabPileVO vo, Principal p) {
        TabUserVo tabUserVo = getUser(p);
        return piLeService.excelImport(excelFile, vo, tabUserVo);
    }

    /**
     * 桩详情
     *
     * @param uuid   uuid标识
     * @param hcdm01 项目泥浆护壁灌注桩编号
     * @return
     */
    @PostMapping("/detail")
    public Result pileDetail(String uuid, String hcdm01) {
        return piLeService.pileDetail(uuid, hcdm01);
    }

    /**
     * 桩删除
     *
     * @param serviceName 服务名称
     * @return
     */
    @PostMapping("/delPileByServiceName")
    public Result delPileByServiceName(String serviceName) {
        return piLeService.delPileByServiceName(serviceName);
    }
}
